package com.wlr.study.leetcode;

/**
 * @author lrwang
 * @version 1.0
 * @date 2021/9/15 0:05
 */
public enum CountryEnum {
    /**
     * 1--齐国
     */
    ONE(1, "齐"),

    TWO(2, "楚"),

    THREE(3, "燕"),

    FOUR(4, "韩"),

    FIVE(5, "赵"),

    SIX(6, "魏"),
    ;


    public Integer getRetCode() {
        return retCode;
    }

    /**
     * set方法
     *
     * @param retCode
     */
    public void setRetCode(Integer retCode) {
        this.retCode = retCode;
    }

    /**
     * get方法
     *
     * @return
     */
    public String getRetMessage() {
        return retMessage;
    }

    /**
     * set方法
     *
     * @param retMessage
     */
    public void setRetMessage(String retMessage) {
        this.retMessage = retMessage;
    }

    /**
     * 返回代码
     */
    private Integer retCode;
    /**
     * 返回信息
     */
    private String retMessage;

    /**
     * 构造方法
     *
     * @param retCode    返回代码
     * @param retMessage 返回信息
     */
    CountryEnum(Integer retCode, String retMessage) {
        this.retCode = retCode;
        this.retMessage = retMessage;
    }

    /**
     * @return
     */
    public static CountryEnum forEach_countryEnum(int index) {
        CountryEnum[] myArray = CountryEnum.values();
        for (CountryEnum countryEnum : myArray) {
            if (index == countryEnum.getRetCode()) {
                return countryEnum;
            }
        }
        return null;
    }
    }
